﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using AKMII.DMRA.Common;
using AKMII.DMRA.DataAccess;

namespace AKMII.DMRA.Business.Rule
{
    public class SystemConfiguration
    {
        private static CommonSetting commonSetting;
        private static List<MonthSetting> monthSettings;

        static SystemConfiguration()
        {
            SettingAccessor accessor = new SettingAccessor();
            commonSetting = accessor.GetCommonSetting();
            monthSettings = accessor.GetMonthSettings();
        }

        public static CommonSetting CommonSetting
        {
            get
            {
                if (commonSetting == null)
                {
                    SettingAccessor accessor = new SettingAccessor();
                    commonSetting = accessor.GetCommonSetting();
                }

                return commonSetting;
            }
            set 
            {
                commonSetting = value;
            }
        }

        public static List<MonthSetting> MonthSettings
        {
            get
            {
                if (monthSettings == null)
                {
                    SettingAccessor accessor = new SettingAccessor();
                    monthSettings = accessor.GetMonthSettings();
                }

                return monthSettings;
            }
            set
            {
                monthSettings = value;
            }
        }
    }
}
